﻿﻿﻿﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
		<c:set var="ctx" value="${pageContext.request.contextPath}" />
		<html>

		<head>
			<link rel="stylesheet" href="${ctx}/common/common.css">
			<title>Title</title>

			<link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
			<link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
			<script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>

			<script src="${ctx}/common/plugins/publicJs/publicJs.js"></script>
			<style>
				.layui-body {
					overflow-y: scroll;
				}

				.laytable-cell-1-cTurl {
					height: 80px;
					line-height: 80px
				}

				.laytable-cell-1-hTurl {
					height: 80px;
					line-height: 80px
				}

				.laytable-cell-1-tTurl {
					height: 80px;
					line-height: 80px
				}
			</style>
		</head>

		<body>
			<!--主体内容层-->
			<div class="layui-fluid">
				<div class="layui-row layui-col-space15">
					<div class="layui-col-md12 layui-col-space15">
						<form class="layui-form">
							<!--输入框内容盒子-->
							<div class="layui-col-md12">
								<div class="layui-col-md4">
									<label class="layui-form-label">姓名：</label>
									<div class="layui-input-block">
										<input type="text" name="name" id="name" required lay-verify="required"
											placeholder="请输入姓名" autocomplete="off" class="layui-input">
									</div>
								</div>
								<!--城市选择通用下拉框-->
								<!-- <div class="layui-col-md3">
							<label class="layui-form-label">部门：</label>
							<div class="layui-input-block">
	                            <select id="dname" name="dname">
	                            	<option value="">请选择</option>
	                            	
	                            </select>
                        	</div>
						</div> -->
							</div>

							<!--通用按钮盒子-->
							<div class="layui-col-md12" style="padding-top: 10px; padding-bottom: 10px">
								<div style="float: right;" class="layui-btn-group paramBtn">
									<button data-type="reloadLabel" type="button"
										class="layui-btn layui-btn-sm layui-btn-danger">查询</button>
									<button data-type="resetLabel" type="reset"
										class="layui-btn layui-btn-sm layui-btn-danger">重置</button>
									<button data-type="backLabel" type="button"
										class="layui-btn layui-btn-sm layui-btn-danger">返回</button>
								</div>
							</div>
						</form>

						<table class="layui-table" id="labelReload"
							lay-data="{ url:'${ctx}/warning/warningPerson/findPersonPage?companyId=${enterpriseId}', page:true,groups:5}"
							lay-filter="demo">
							<thead>
								<tr>
									<!--  <th lay-data="{type:'checkbox', fixed: 'left'}"></th> -->
									<th lay-data="{field:'name'}">姓名</th>
									<!-- <th lay-data="{field:'eName'}">企业名称</th> -->
									<th lay-data="{field:'dName'}">部门</th>
									<!-- <th lay-data="{field:'cTurl',toolbar:'#c'}">身份证</th>
							<th lay-data="{field:'cDate'}">身份证有效期</th>
							<th lay-data="{field:'hTurl',toolbar:'#h'}">健康证</th>
							<th lay-data="{field:'hDate'}">健康证有效期</th>
							<th lay-data="{field:'tTurl',toolbar:'#t'}">化验员资格证</th>
							<th lay-data="{field:'tDate'}">有效期</th> -->
									<th lay-data="{field:'phone'}">联系电话</th>
									<th lay-data="{field:'right',toolbar:'#barDemo'}">操作</th>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</div>
			<script type="text/html" id="barDemo">
				<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详细</a>
			</script>
			<script type="text/html" id="c">
				{{#  if(d.cTurl !=null&&d.cTurl !=''){ }}
				<img style="width: 80px;height: 80px;" src="${ctx}{{d.cTurl}}" class="layui-upload-img">
				{{#  } }}
			</script>
			<script type="text/html" id="h">
				{{#  if(d.hTurl !=null&&d.hTurl !=''){ }}
				<img style="width: 80px;height: 80px;" src="${ctx}{{d.hTurl}}" class="layui-upload-img">
				{{#  } }}
			</script>
			<script type="text/html" id="t">
				{{#  if(d.tTurl !=null&&d.tTurl !=''){ }}
				<img style="width: 80px;height: 80px;" src="${ctx}{{d.tTurl}}" class="layui-upload-img">
				{{#  } }}
			</script>
			<script id="createTime" type="text/html">
				{{# return layui.getDate(d.create_time, 'yyyy-MM-dd hh:mm:ss');}}
			</script>
		</body>
		<script>
			layui
				.use(
					'table',
					function () {
						var loading = layer.msg("数据加载中...");
						var table = layui.table;
						table.render({
							done: function () {
								layer.close(loading);
							}
						})
						//监听filter为demo的table中的工具条
						table
							.on(
								'tool(demo)',
								function (obj) {
									var data = obj.data;
									if (obj.event === 'check') {
										window.location.href = '${ctx}/warning/warningEnterprise/enterpriseDetail?enterpriseId='
											+ obj.data.id
									}
									if (obj.event == 'detail') {
										window.location.href = '${ctx}/person/personEditPage?personId=' + obj.data.id + "&detail=true&enterpriseId=${enterpriseId}"
									}
								});

						var $ = layui.$, active = {
							reloadLabel: function () {//条件查询
								var name = document.getElementById("name").value;
								table.reload('labelReload', {
									where: {
										name: name
									}
								});
							},
							resetLabel: function () {
								table.reload('labelReload', {
									where: {
										name: ''

									}
								})
							},
							backLabel: function () {
								window.location.href = "${ctx}/supervise/enterprise/enterprisePage";
							}
						};

						$('.demoTable .layui-btn').on('click', function () {
							var type = $(this).data('type');
							active[type] ? active[type].call(this) : '';
						});
						//给按钮绑定active中的方法
						$(".paramBtn .layui-btn").on("click", function () {
							var type = $(this).data('type');
							//查看是active这个json中是否有type这个方法，如果有调用，如果没有不知心；
							active[type] ? active[type].call() : '';
						})

						/**
						 * 点击生产企业按钮
						 */
						$("#prodictionButton")
							.on(
								"click",
								function () {
									layer
										.open({
											type: 2,
											title: '生产企业',
											shadeClose: true,
											offset: '10px',
											shade: 0.8,
											area: ['50%', '100%'],
											content: '${ctx}/productionDetection/queryEnterpriseAll?companyIds='
												+ $(
													"#productionCompanyId")
													.val() //iframe的url
										});
								})

					});
		</script>

		</html>